package com.valuegroup.smarttodo.data.enums;

import com.valuegroup.smarttodo.R;

public enum GoalSortTypeEnum {
    NORMAL(R.id.goal_sort_item0, R.string.goal_sort_m0, 0),
    STAR(R.id.goal_sort_item1, R.string.goal_sort_m1, 1),
    RANGE(R.id.goal_sort_item2, R.string.goal_sort_m2, 2),
    FINISH(R.id.goal_sort_item3, R.string.goal_sort_m3, 3),
    ABC(R.id.goal_sort_item4, R.string.goal_sort_m4, 4),
    CREATEDDT(R.id.goal_sort_item5, R.string.goal_sort_m5, 5);

    private int menuId;
    private int sortType;
    private int textId;

    GoalSortTypeEnum(int menuId, int textId, int sortType) {
        this.menuId = menuId;
        this.textId = textId;
        this.sortType = sortType;
    }

    public static GoalSortTypeEnum getSortTypeForMenuId(int menuId) {
        for (GoalSortTypeEnum e : GoalSortTypeEnum.values()) {
            if (e.menuId == menuId) {
                return e;
            }
        }
        return GoalSortTypeEnum.NORMAL;
    }

    public static GoalSortTypeEnum getSortTypeEnum(int sortType) {
        for (GoalSortTypeEnum e : GoalSortTypeEnum.values()) {
            if (e.sortType == sortType) {
                return e;
            }
        }
        return GoalSortTypeEnum.NORMAL;
    }

    public static boolean isNormal(int sortType) {
        if (GoalSortTypeEnum.NORMAL.sortType == sortType) {
            return true;
        }
        return false;
    }

    public int getMenuId() {
        return menuId;
    }

    public int getSortType() {
        return sortType;
    }

    public int getTextId() {
        return textId;
    }
}
